import { baseUrl } from '@/config'

// 封装公共请求函数
export function request(url, data, method) {
    // const token = uni.getStorageSync('token') // 从本地缓存中获取token

    return new Promise((resolve, reject) => {
        uni.request({
            url: `${baseUrl}${url}`,
            method: method,
            data: data,
            header: {
                'content-type': 'application/json',
                // token: token,
            },
            success: (res) => {
                resolve(res.data)
            },
            fail: (err) => {
                reject(err)
            },
        })
    })
}